package com.unitd.logistics.comm.exception;

import com.unitd.logistics.comm.enums.ResultEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 自定义的异常信息类, 用于按照自定义规则抛出异常信息
 *
 * @author hudan
 * @version 1.0
 * @filename LogisticsException.java
 * @copyright www.pactera.com
 * @date 2019-01-25
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class LogisticsException extends RuntimeException {

	/**
	 * 错误代码
	 */
	private Integer code;

	public LogisticsException(ResultEnum resultEnum) {
		super(resultEnum.getMessage());

		this.code = resultEnum.getCode();
	}

	public LogisticsException(ResultEnum resultEnum, String messasge) {
		super(messasge);

		this.code = resultEnum.getCode();
	}

	public LogisticsException(Integer code, String message) {
		super(message);
		this.code = code;
	}
}
